/**
 * 
 */
package officeserver.office;

import java.io.Serializable;

import officeserver.users.Doctor;

/**
 * @author mramsey3
 * 
 */
public class Calendar implements Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    private static Day[] calendar = new Day[730];

    public static Day getDay(int day) {
	if (calendar[day] == null) {
	    calendar[day] = new Day();
	}
	return calendar[day];
    }

    public static void discoverNewDoctor() {
	int numDoctors = Doctor.getCounter();
	// System.out.println( "CCount: " + numDoctors);
	for (Day day : calendar) {
	    if (day != null) {
		day.discoverNewDoctor();
	    }
	}
    }

    public static Day[] getCalendar() {
	return calendar;
    }

    public static void setCalendar(Day[] calendarToSet) {
	calendar = calendarToSet;
    }

    public static void clear() {
	try {
	    for (Day day : calendar) {
		day.clear();
	    }
	} catch (Exception e) {
	    calendar = new Day[730];
	}
    }
}
